package com.bsj.media.media.resample;

public class resamplerState {
	
	public int in_rate;
	public int out_rate;
	public int num_rate;
	public int den_rate;
	 
	public int     quality;
	public int     nb_channels;
	public int     filt_len;
	public int     mem_alloc_size;
	public int     buffer_size;
	public int     int_advance;
	public int     frac_advance;
	public float      cutoff;
	public long      oversample;
	public int          initialised;
	public int          started;

	 /* These are per-channel */
	public int[]  last_sample;
	public int[]  samp_frac_num;
	public int[]  magic_samples;

	public float[] mem;
	public float[] sinc_table;
	public int sinc_table_length;

	public int    in_stride;
	public int    out_stride;
	

	public static int speex_resampler_get_in_rate(resamplerState st) {
		return st.in_rate;
	}

	public static int speex_resampler_get_out_rate(resamplerState st) {
		return st.out_rate;
	}

	public static int speex_resampler_get_ratio_num(resamplerState st) {
		return st.num_rate;
	}

	public static int speex_resampler_get_ratio_den(resamplerState st) {
		return st.den_rate;
	}

	public static int speex_resampler_get_quality(resamplerState st) {
		return st.quality;
	}

	public static void speex_resampler_set_input_stride(resamplerState st, int stride) {
		st.in_stride = stride;
	}

	public static int speex_resampler_get_input_stride(resamplerState st) {
		return st.in_stride;
	}

	public static void speex_resampler_set_output_stride(resamplerState st, int stride) {
		st.out_stride = stride;
	}

	public static int speex_resampler_get_output_stride(resamplerState st) {
		return st.out_stride;
	}

	public static int speex_resampler_get_input_latency(resamplerState st) {
		return st.filt_len / 2;
	}

	public static int speex_resampler_get_output_latency(resamplerState st) {
		return ((st.filt_len / 2) * st.den_rate + (st.num_rate >> 1)) / st.num_rate;
	}
}
